<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>LiftSimu: /Users/alrik/Documents/workspace/LiftSimu/src/JDisplay.java Quellcode</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="up.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">LiftSimu
   
   </div>
   <div id="projectbrief">die Simulation einer Liftanlage</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Erzeugt von Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Suchen');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Hauptseite</span></a></li>
      <li><a href="annotated.html"><span>Klassen</span></a></li>
      <li class="current"><a href="files.html"><span>Dateien</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Suchen" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Auflistung&#160;der&#160;Dateien</span></a></li>
    </ul>
  </div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Alle</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Klassen</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Dateien</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funktionen</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variablen</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">/Users/alrik/Documents/workspace/LiftSimu/src/JDisplay.java</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_j_display_8java.html">gehe zur Dokumentation dieser Datei</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="keyword">import</span> java.awt.*;
<a name="l00002"></a>00002 <span class="keyword">import</span> javax.swing.*;
<a name="l00003"></a>00003 
<a name="l00024"></a>00024 @SuppressWarnings(<span class="stringliteral">&quot;serial&quot;</span>)
<a name="l00025"></a><a class="code" href="class_j_display.html">00025</a> public class <a class="code" href="class_j_display.html" title="Ein eigenes Oberflächenelement mit abgerundeten Ecken.">JDisplay</a> extends JPanel{
<a name="l00026"></a><a class="code" href="class_j_display.html#a636a4925fd1542a8da110c880cb40ebc">00026</a>    <span class="keyword">private</span> JLabel <a class="code" href="class_j_display.html#a636a4925fd1542a8da110c880cb40ebc">label</a>;
<a name="l00027"></a><a class="code" href="class_j_display.html#a39367a7784764caf87e4e6291e86f8df">00027</a>    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="class_j_display.html#a39367a7784764caf87e4e6291e86f8df">arrowing</a>;
<a name="l00028"></a>00028    
<a name="l00036"></a><a class="code" href="class_j_display.html#a5a822ea8f3bf265a7f8161461a4ffff6">00036</a>    <span class="keyword">public</span> <a class="code" href="class_j_display.html#a5a822ea8f3bf265a7f8161461a4ffff6" title="Der Konstruktor mit einem Parameter.">JDisplay</a>(String <span class="keywordtype">string</span>) {
<a name="l00037"></a>00037       super();
<a name="l00038"></a>00038       init(<span class="keywordtype">string</span>);
<a name="l00039"></a>00039    }
<a name="l00040"></a>00040    
<a name="l00046"></a><a class="code" href="class_j_display.html#ab30832f79b8b0bc447e334ad925cfaed">00046</a>    <span class="keyword">public</span> <a class="code" href="class_j_display.html#ab30832f79b8b0bc447e334ad925cfaed" title="Der Konstruktor ohne Parameter.">JDisplay</a>(){
<a name="l00047"></a>00047       super();
<a name="l00048"></a>00048       init(<span class="stringliteral">&quot;AUßER BETRIEB&quot;</span>);
<a name="l00049"></a>00049    }
<a name="l00050"></a>00050    
<a name="l00056"></a><a class="code" href="class_j_display.html#a20e7498277954fc5c024c56a3b777ef1">00056</a>    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="class_j_display.html#a20e7498277954fc5c024c56a3b777ef1" title="Diese Methode schaltet im Display den Pfeil nach oben an.">showuparrow</a>(){
<a name="l00057"></a>00057       arrowing=1;
<a name="l00058"></a>00058       repaint();
<a name="l00059"></a>00059    }
<a name="l00060"></a>00060    
<a name="l00066"></a><a class="code" href="class_j_display.html#a5dad7267c8c18ecb1bb5c32b15ab897a">00066</a>    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="class_j_display.html#a5dad7267c8c18ecb1bb5c32b15ab897a" title="Diese Methode schaltet im Display den Pfeil unten an.">showdownarrow</a>(){
<a name="l00067"></a>00067       arrowing=-1;
<a name="l00068"></a>00068       repaint();
<a name="l00069"></a>00069    }
<a name="l00070"></a>00070    
<a name="l00076"></a><a class="code" href="class_j_display.html#aaabb3ff015351b0589021af7d2a22063">00076</a>    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="class_j_display.html#aaabb3ff015351b0589021af7d2a22063" title="Diese Methode schaltet im Display den Pfeil aus.">hidearrows</a>(){
<a name="l00077"></a>00077       arrowing=0;
<a name="l00078"></a>00078       repaint();
<a name="l00079"></a>00079    }
<a name="l00080"></a>00080    
<a name="l00088"></a><a class="code" href="class_j_display.html#a604945d8e7a28b2ba7031da0979df7d3">00088</a>    <span class="keyword">private</span> <span class="keywordtype">void</span> <a class="code" href="class_j_display.html#a604945d8e7a28b2ba7031da0979df7d3" title="Diese Methode initialisiert das Display.">init</a>(String <span class="keywordtype">string</span>){
<a name="l00089"></a>00089       hidearrows();
<a name="l00090"></a>00090       label=<span class="keyword">new</span> JLabel();
<a name="l00091"></a>00091       label.setFont(<span class="keyword">new</span> Font(Font.SANS_SERIF, Font.PLAIN, 20));
<a name="l00092"></a>00092       label.setForeground(Color.red);
<a name="l00093"></a>00093       label.setText(<span class="keywordtype">string</span>);
<a name="l00094"></a>00094       add(label);
<a name="l00095"></a>00095    }
<a name="l00096"></a>00096    
<a name="l00104"></a><a class="code" href="class_j_display.html#a3bfccf36aec4b599002409760c727b33">00104</a>    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="class_j_display.html#a3bfccf36aec4b599002409760c727b33" title="Diese Methode zeigt einem bestimmten Text im Display.">setText</a>(String <span class="keywordtype">string</span>){
<a name="l00105"></a>00105       label.setText(<span class="keywordtype">string</span>);
<a name="l00106"></a>00106    }
<a name="l00107"></a>00107    
<a name="l00115"></a><a class="code" href="class_j_display.html#a5d4421c0b3f0c1f32d05429dcf281d2f">00115</a>    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="class_j_display.html#a5d4421c0b3f0c1f32d05429dcf281d2f" title="Diese Methode zeigt im Display eine bestimmte Etage an.">setEtage</a>(<span class="keywordtype">int</span> Etage){
<a name="l00116"></a>00116       label.setText(Integer.toString(Etage)+<span class="stringliteral">&quot;.Etage&quot;</span>);   
<a name="l00117"></a>00117    }
<a name="l00118"></a>00118 
<a name="l00126"></a><a class="code" href="class_j_display.html#a69ba26eb511fa230e787132408b497e8">00126</a>    <span class="keyword">public</span> String <a class="code" href="class_j_display.html#a69ba26eb511fa230e787132408b497e8" title="Diese Methode gibt den Displaytext zurück.">getText</a>(){
<a name="l00127"></a>00127       <span class="keywordflow">return</span> label.getText();
<a name="l00128"></a>00128    }
<a name="l00129"></a>00129       
<a name="l00138"></a><a class="code" href="class_j_display.html#a1817acffc20f89aa59a41c32590c987b">00138</a>    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="class_j_display.html#a1817acffc20f89aa59a41c32590c987b" title="Diese Methode zeichnet das Display.">paintComponent</a>(<span class="keyword">final</span> Graphics g) {
<a name="l00139"></a>00139       <span class="comment">//* Abgerundete Eck</span>
<a name="l00140"></a>00140       g.setColor(getBackground());
<a name="l00141"></a>00141       g.fillRect(0, 0, getBounds().width, getBounds().height);
<a name="l00142"></a>00142       g.setColor(Color.black);
<a name="l00143"></a>00143       g.fillRoundRect(0,0,this.getBounds().width, this.getBounds().height,20, 20);
<a name="l00144"></a>00144       <span class="comment">//* Pfeile</span>
<a name="l00145"></a>00145       g.setColor(Color.red);
<a name="l00146"></a>00146       Stroke stroke = <span class="keyword">new</span> BasicStroke( 3 );
<a name="l00147"></a>00147       
<a name="l00148"></a>00148       Graphics2D g2 = (Graphics2D) g;
<a name="l00149"></a>00149       g2.setStroke(stroke);
<a name="l00150"></a>00150 
<a name="l00151"></a>00151       <span class="keywordflow">if</span>(arrowing==1){
<a name="l00152"></a>00152          
<a name="l00153"></a>00153          g2.drawLine(getBounds().width-20, 5, getBounds().width-20, getBounds().height-5);
<a name="l00154"></a>00154          g2.drawLine(getBounds().width-20, 5, getBounds().width-30, 20);
<a name="l00155"></a>00155          g2.drawLine(getBounds().width-20, 5, getBounds().width-10, 20);
<a name="l00156"></a>00156       }<span class="keywordflow">else</span> <span class="keywordflow">if</span>(arrowing == -1){
<a name="l00157"></a>00157          g2.drawLine(getBounds().width-20, 5, getBounds().width-20, getBounds().height-5);
<a name="l00158"></a>00158          g2.drawLine(getBounds().width-20, getBounds().height-5, getBounds().width-30, getBounds().height-25);
<a name="l00159"></a>00159          g2.drawLine(getBounds().width-20, getBounds().height-5, getBounds().width-10, getBounds().height-25);
<a name="l00160"></a>00160       }
<a name="l00161"></a>00161       
<a name="l00162"></a>00162       
<a name="l00163"></a>00163    }
<a name="l00164"></a>00164 }
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Erzeugt am Fre Jul 6 2012 16:05:55 für LiftSimu von &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
